<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
    <head>
    <meta charset="UTF-8">
    <%@ include file="/WEB-INF/views/include/head.jsp"%> 
    <link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
        <script type="text/javascript">
            $(document).ready(function(){
                if($("#listLength").val()>0){
                    $("#contain").addClass('tabScroll');
                    $('.tabScroll tbody tr:first-child td').each(function(){
                        var indexNum = $(this).index()
                        var tdWidth = $('.tabScroll tbody tr:first-child td').eq(indexNum).width()
                        $('.tabScroll thead tr th').eq(indexNum).width(tdWidth)
                    });
                 }
                
               });
            //删除项目
            function delCategory(){
                // 调用后台删除方法
                $.post("${ctx}/material/category/delete?id=${category.id}&&oldItemValue=${category.oldItemValue}",'',function(result){
                    // 提示信息
                    tipParent(result.message);
                    // 返回结果
                    if(result.statusCode==STATUSCODEOK){
                        // 刷新页面
                        window.parent.frames[0].location.reload();
                        closeWin(); 
                     }
                },'json');
            }
        </script>
    </head>
    <body>
        <!--头部-->
        <div class="myshop clearfix">
            <p class="myshoptop fl"><spring:message code="category_show"/></p>
            <div class="fr">
                <shiro:hasPermission name="material:stock:edit">
                <!-- 编辑 -->
                <div class="topBtn" onclick="popup('935px','550px','${ctx}/material/category/form?id=${category.id}');closeWin()">
                    <img src="${ctxStatic}/images/btn-bj.png">
                </div>
                <!-- 删除 -->
                <div class="topBtn" onclick="del(delCategory)">
                    <img src="${ctxStatic}/images/btn-sc.png">
                </div>
                </shiro:hasPermission>
                <!-- 关闭 -->
                <div class="topBtnClose" onclick="closeWin()">
                    <img src="${ctxStatic}/images/btn-close.png">
                </div>
            </div>
        </div>
        <div class="myshop_middle">
        <input type="hidden"  id="listLength" value="${fn:length(categoryList) } "/>
            <div class="data clearfix">
                <div class="ch fl">
                <!-- 物料分类代码 -->
                    <p class="data_id_list"><spring:message code="category_show_code"/></p>
                    <p class="rtname fl">${category.itemCode}</p>
                </div>
                <div class="ch fr">
                <!-- 分类值 -->
                    <p class="data_id_list"><spring:message code="category_show_itemValue"/></p>
                    <p class="rtname fl">${category.itemValue}</p>
                </div>
            </div>
            <div class="data clearfix">
                <div class="ch fl">
                    <!-- 中文全称 -->
                    <p class="data_id_list"><spring:message code="category_show_Cn"/></p>
                    <p class="rtname fl" data-toggle="tooltip" title="${category.itemNameCn}">${category.itemNameCn}</p>
                </div>
                <div class="ch fr">
                    <!-- 英文全称 -->
                    <p class="data_id_list"><spring:message code="category_show_En"/></p>
                    <p class="rtname fl" data-toggle="tooltip" title="${category.itemNameEn}">${category.itemNameEn}</p>
                </div>
            </div>
            <div class="data clearfix">
                <!-- 子项目 -->
                <p class="data_id"><spring:message code="category_show_sub"/></p>
                <div class="tableBox">
                    <div class="tableSm tableBor">
                        <div style="height:170px;" id="contain">
                            <table>
                                <thead>
                                    <tr>
                                        <!-- 项目值 -->
                                        <th><spring:message code="category_show_subItemValue"/></th>
                                        <!-- 中文全称 -->
                                        <th><spring:message code="category_show_subCn"/></th>
                                        <!-- 英文全称 -->
                                        <th><spring:message code="category_show_subEn"/></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <c:forEach items="${categoryList}" var="categoryList" varStatus="status">
                                        <tr>
                                            <td><p>${categoryList.itemValue}</p></td>
                                            <td><p data-toggle="tooltip" title="${categoryList.itemNameCn}">${categoryList.itemNameCn}</p></td>
                                            <td><p data-toggle="tooltip" title="${categoryList.itemNameEn}">${categoryList.itemNameEn}</p></td>
                                        </tr>
                                    </c:forEach>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <div class="data clearfix">
                <div class="fl">
                    <div class="clearfix">
                        <!-- 状态 -->
                        <p class="data_id_list"><spring:message code="category_state"/></p>
                        <c:choose>
                            <c:when test="${category.enableFlag eq 1}"><p class="rtname fl"><spring:message code="category_enable"/></p></c:when>
                        </c:choose>
                        <c:choose>
                            <c:when test="${category.enableFlag eq 0}"><p class="rtname fl"><spring:message code="category_disable"/></p></c:when>
                        </c:choose>
                    </div>
                </div>
                <div class="ch fr clearfix">
                    <!-- 描述 -->
                    <p class="data_id_list"><spring:message code="category_show_remarks"/></p>
                    <p class="rtname fl" data-toggle="tooltip" title="${category.remarks}">${category.remarks}</p>
                </div>
            </div>
        </div>
        <script>
            var windowH = window.innerHeight
                    ||document.documentElement.clientHeight
                    ||document.body.clientHeight
            $('.middle').css('height',windowH - 50);
        </script>
    </body>
</html>